<?php


namespace app\api\controller;
header('Access-Control-Allow-Origin:*');
use app\BaseController;

class Index extends BaseController
{
    public function index()
    {
        if(!$this->request->isPost()){
            $data = ['name'=>'小红','age'=>10,'class'=>'一年级'];
            return json($data);
        }else{
            $data = ['name'=>'小蓝','age'=>10,'class'=>'一年级'];
            return json($data);
        }

    }

    public function api()
    {
        return show(200);
    }

    public function one()
    {
        return json($this->request->param('name'));
    }
}